
      subroutine systempsmovieSOL(nx,nz,deltax,deltaz,f1,f2,f3,d3,filename,title,&
      & label1,label2,wbox,d1num,d2num,x1beg,x1end,x2beg,x2end,wclip,bclip)



      implicit none
      integer ::  i,j
      complex*16, parameter :: imag=(0.,1.0)
      complex*16 ::Ptaux
      integer nx, nz
      character*5 filename
      character*20 :: title,label1,label2
      double precision :: wclip,bclip
      double precision :: wbox,hbox,lx,f1,f2,f3,x1beg,x1end,x2beg,x2end
      double precision :: deltax,deltaz,d3,d1num,d2num
      character*1, parameter:: apos=achar(39)! apostrophe
      character*10 :: chwclip,chbclip
      character*5 :: chn1,chn2
      character*10 :: chdeltax,chdeltaz,chd3,chd1num,chd2num,chwbox,chhbox,chlx,chf1,chf2,chf3,chx1beg,chx1end,chx2beg,chx2end

 

      write(*,*)
      write(*,*)
      write(*,*)'*******************************  PSMOVIE  ************************************'

	  write(chwclip,'(E10.4)')wclip
!       if(wclip.lt.10)then
! 	  write(chwclip,'(f2.0)')wclip
!       elseif(wclip.lt.100)then
! 	  write(chwclip,'(f3.0)')wclip
!       elseif(wclip.lt.1000)then
! 	  write(chwclip,'(f4.0)')wclip
!       elseif(wclip.lt.10000)then
! 	  write(chwclip,'(f5.0)')wclip
!       endif
	  write(chbclip,'(E10.4)')bclip
!       if(bclip.lt.10)then
! 	  write(chbclip,'(f2.0)')bclip
!       elseif(bclip.lt.100)then
! 	  write(chbclip,'(f3.0)')bclip
!       elseif(bclip.lt.1000)then
! 	  write(chbclip,'(f4.0)')bclip
!       elseif(bclip.lt.10000)then
! 	  write(chbclip,'(f5.0)')bclip
!       endif

      if(nz.lt.10)then
	  write(chn1,'(i1)')nz
	  chn1 = '0000'//chn1
      elseif(nz.lt.100)then
	  write(chn1,'(i2)')nz
	  chn1 = '000'//chn1
      elseif(nz.lt.1000)then
	  write(chn1,'(i3)')nz
	  chn1 = '00'//chn1
      elseif(nz.lt.10000)then
	  write(chn1,'(i4)')nz
	  chn1 = '0'//chn1
      elseif(nz.lt.100000)then
	  write(chn1,'(i5)')nz
	  chn1 = chn1
      endif


      if(nx.lt.10)then
	  write(chn2,'(i1)')nx
	  chn2 = '0000'//chn2 
      elseif(nx.lt.100)then
	  write(chn2,'(i2)')nx
	  chn2 = '000'//chn2 
      elseif(nx.lt.1000)then
	  write(chn2,'(i3)')nx
	  chn2 = '00'//chn2 
      elseif(nx.lt.10000)then
	  write(chn2,'(i4)')nx
	  chn2 = '0'//chn2 
      elseif(nx.lt.100000)then
	  write(chn2,'(i5)')nx
	  chn2 = chn2 
      endif
  

	  write(chdeltax,'(E10.4)')deltax
	  write(chdeltaz,'(E10.4)')deltaz
!       if(delta.lt.10.)then
! 	  write(chdelta,'(f4.2)')delta
!       elseif(delta.lt.100.)then
! 	  write(chdelta,'(f5.2)')delta
!       elseif(delta.lt.1000.)then
! 	  write(chdelta,'(f6.2)')delta
!       elseif(delta.lt.10000.)then
! 	  write(chdelta,'(f7.2)')delta
!       endif

	  write(chd3,'(E10.4)')d3
!       if(d3.lt.0.000001)then
! 	  write(*,*)'erro no formato do d3'
!       elseif(d3.lt.0.00001)then
! 	  write(chd3,'(f8.6)')d3
!       elseif(d3.lt.0.0001)then
! 	  write(chd3,'(f7.5)')d3
!       elseif(d3.lt.0.001)then
! 	  write(chd3,'(f6.4)')d3
!       elseif(d3.lt.0.01)then
! 	  write(chd3,'(f5.3)')d3
!       elseif(d3.lt.0.1)then
! 	  write(chd3,'(f4.2)')d3
!       elseif(d3.lt.1.)then
! 	  write(chd3,'(f4.2)')d3
!       elseif(d3.lt.10.)then
! 	  write(chd3,'(f4.2)')d3
!       elseif(d3.lt.100.)then
! 	  write(chd3,'(f5.2)')d3
!       elseif(d3.lt.1000.)then
! 	  write(chd3,'(f6.2)')d3
!       elseif(d3.lt.10000.)then
! 	  write(chd3,'(f7.2)')d3
!       endif
	  write(chd1num,'(E10.4)')d1num
!       if(d1num.lt.10.)then
! 	  write(chd1num,'(f4.2)')d1num
!       elseif(d1num.lt.100.)then
! 	  write(chd1num,'(f5.2)')d1num
!       elseif(d1num.lt.1000.)then
! 	  write(chd1num,'(f6.2)')d1num
!       elseif(d1num.lt.10000.)then
! 	  write(chd1num,'(f7.2)')d1num
!       endif

	  write(chd2num,'(E10.4)')d2num
!       if(d2num.lt.10.)then
! 	  write(chd2num,'(f4.2)')d2num
!       elseif(d2num.lt.100.)then
! 	  write(chd2num,'(f5.2)')d2num
!       elseif(d2num.lt.1000.)then
! 	  write(chd2num,'(f6.2)')d2num
!       elseif(d2num.lt.10000.)then
! 	  write(chd2num,'(f7.2)')d2num
!       endif

	  write(chwbox,'(E10.4)')wbox
!       if(wbox.lt.10.)then
! 	  write(chwbox,'(f4.2)')wbox
!       elseif(wbox.lt.100.)then
! 	  write(chwbox,'(f5.2)')wbox
!       elseif(wbox.lt.1000.)then
! 	  write(chwbox,'(f6.2)')wbox
!       elseif(wbox.lt.10000.)then
! 	  write(chwbox,'(f7.2)')wbox
!       endif


      hbox = (nz*wbox)/dfloat(nx)
	  write(chhbox,'(E10.4)')hbox
!       if(hbox.lt.10.)then
! 	  write(chhbox,'(f4.2)')hbox
!       elseif(hbox.lt.100.)then
! 	  write(chhbox,'(f5.2)')hbox
!       elseif(hbox.lt.1000.)then
! 	  write(chhbox,'(f6.2)')hbox
!       elseif(hbox.lt.10000.)then
! 	  write(chhbox,'(f7.2)')hbox
!       endif

      write(chf1,'(E10.4)')f1
!       if(abs(f1).lt.10.)then
! 	  if(f1.ge.0)write(chf1,'(f4.2)')f1
! 	  if(f1.lt.0)write(chf1,'(f5.2)')f1
!       elseif(abs(f1).lt.100.)then
! 	  if(f1.ge.0)write(chf1,'(f5.2)')f1
! 	  if(f1.lt.0)write(chf1,'(f6.2)')f1
!       elseif(abs(f1).lt.1000.)then
! 	  if(f1.ge.0)write(chf1,'(f6.2)')f1
! 	  if(f1.lt.0)write(chf1,'(f7.2)')f1
!       elseif(abs(f1).lt.10000.)then
! 	  if(f1.ge.0)write(chf1,'(f7.2)')f1
! 	  if(f1.lt.0)write(chf1,'(f8.2)')f1
!       endif

      write(chf2,'(E10.4)')f2
!       if(abs(f2).lt.10.)then
! 	  if(f2.ge.0)write(chf2,'(f4.2)')f2
! 	  if(f2.lt.0)write(chf2,'(f5.2)')f2
!       elseif(abs(f2).lt.100.)then
! 	  if(f2.ge.0)write(chf2,'(f5.2)')f2
! 	  if(f2.lt.0)write(chf2,'(f6.2)')f2
!       elseif(abs(f2).lt.1000.)then
! 	  if(f2.ge.0)write(chf2,'(f6.2)')f2
! 	  if(f2.lt.0)write(chf2,'(f7.2)')f2
!       elseif(abs(f2).lt.10000.)then
! 	  if(f2.ge.0)write(chf2,'(f7.2)')f2
! 	  if(f2.lt.0)write(chf2,'(f8.2)')f2
!       endif

	  write(chf3,'(E10.4)')f3
!       if(f3.lt.10.)then
! 	  write(chf3,'(f4.2)')f3
!       elseif(f3.lt.100.)then
! 	  write(chf3,'(f5.2)')f3
!       elseif(f3.lt.1000.)then
! 	  write(chf3,'(f6.2)')f3
!       elseif(f3.lt.10000.)then
! 	  write(chf3,'(f7.2)')f3
!       endif
      write(chx1beg,'(E10.4)')x1beg
      write(chx1end,'(E10.4)')x1end
      write(chx2beg,'(E10.4)')x2beg
      write(chx2end,'(E10.4)')x2end

      write(*,*)'psmovie <'//filename//'.bin'//' n1='//chn1//' d1='//chdeltaz//' n2='//chn2//' d2='//chdeltax//&
		& ' d3='//chd3//' f1='//chf1//' f2='//chf2//' f3='//chf3//&
		& ' x1beg='//chx1beg//' x1end='//chx1end//' x2beg='//chx2beg//' x2end='//chx2end//&
		& ' f1num=0.00'//' f2num=0.00'//&
		& ' title='//apos//title//apos//' label1='//apos//label1//apos//&
		& ' label2='//apos//label2//apos//&
		& ' wbox='//chwbox//' hbox='//chhbox//' d1num='//chd1num//' d2num='//chd2num//&
! 		& ' title2='//apos//'iter.'//apos// &
		& ' bclip='//chbclip//' wclip='//chwclip//&
		& ' labelsize=12 titlesize=18 verbose=0 >'//filename//'.ps  &'

      call system('psmovie <'//filename//'.bin'//' n1='//chn1//' d1='//chdeltaz//' n2='//chn2//' d2='//chdeltax//&
		& ' d3='//chd3//' f1='//chf1//' f2='//chf2//' f3='//chf3//&
		& ' x1beg='//chx1beg//' x1end='//chx1end//' x2beg='//chx2beg//' x2end='//chx2end//&
		& ' f1num=0.00'//' f2num=0.00'//&
		& ' title='//apos//title//apos//' label1='//apos//label1//apos//&
		& ' label2='//apos//label2//apos//&
		& ' wbox='//chwbox//' hbox='//chhbox//' d1num='//chd1num//' d2num='//chd2num//&
! 		& ' title2='//apos//'iter.'//apos// &
		& ' bclip='//chbclip//' wclip='//chwclip//&
		& ' labelsize=12 titlesize=18 verbose=0 >'//filename//'.ps  &')




      return

!  151  format(//a390//)
      end